package com.kaka.jsonmap.core;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class DictionaryManager {
    private final Map<String, Map<String, String>> dictionaries = new HashMap<>();

    public void loadDictionaries(Map<String, Map<String, String>> dictMap) {
        dictionaries.putAll(dictMap);
    }

    public Object getMappedValue(String dictName, String key) {
        Map<String, String> dict = dictionaries.get(dictName);
        if (dict == null) {
            log.warn("Dictionary '{}' not found", dictName);
            return null;
        }
        return dict.getOrDefault(key, null);
    }
}